package org.example.lethear.dto.comment;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.List;

/**
 * 评论DTO
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class CommentDTO {
    
    private Long id;
    private String content;
    private String imageUrl;
    private Boolean isTop;
    private Long likeCount;
    private LocalDateTime createdAt;
    private LocalDateTime updatedAt;
    
    /**
     * 评论者信息
     */
    private AuthorInfo author;
    
    /**
     * 帖子信息
     */
    private PostInfo post;
    
    /**
     * 父评论ID（如果是回复）
     */
    private Long parentId;
    
    /**
     * 回复的评论ID（如果是回复）
     */
    private Long replyToId;
    
    /**
     * 回复的用户信息（如果是回复）
     */
    private AuthorInfo replyToUser;
    
    /**
     * 子评论列表
     */
    private List<CommentDTO> children;
    
    /**
     * 当前用户是否点赞
     */
    private Boolean isLiked;
    
    /**
     * 评论者信息内部类
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class AuthorInfo {
        private Long id;
        private String username;
        private String nickname;
        private String avatar;
    }
    
    /**
     * 帖子信息内部类
     */
    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @Builder
    public static class PostInfo {
        private Long id;
        private String title;
        private Long authorId;
        private String authorUsername;
    }
} 